﻿using Microsoft.ServiceModel.Web;
using System;
using System.ServiceModel;
using System.ServiceModel.Web;

namespace WCFDataService
{
    [ServiceContract]
    public interface IDataService<TItem> where TItem : class
    {
        //[OperationContract]
        //[WebGet(UriTemplate = "/datasource/{datasourcename}/json", ResponseFormat = WebMessageFormat.Json)]
        //[WebHelp(Comment = "Returns the specified data source item in JSON format.")]
        //TItem GetDataJSON(string datasourcename);

        //[OperationContract]
        //[WebGet(UriTemplate = "/datasource/{datasourcename}", ResponseFormat = WebMessageFormat.Xml)]
        //[WebHelp(Comment = "Returns the specified data source item in XML format.")]
        //TItem GetDefaultDataXML(string datasourcename);

        [OperationContract]
        [WebGet(UriTemplate = "/datasource/{datasourcename}/tq?tq={tq}&tqx={tqx}")]
        [WebHelp(Comment = "Returns the specified data source item processed with the given tq and tqx query in JSON format.")]
        TItem GetDataJSON(string datasourcename, string tq, string tqx);


        #region To Be Deleted
        //[WebHelp(Comment = "Initializes the item based on the incoming JSON.")]
        //[WebInvoke(Method = "POST", UriTemplate = "?format=json", ResponseFormat = WebMessageFormat.Json)]
        //[OperationContract]
        //TItem AddItemInJson(TItem initialValue);
        //[OperationContract]
        //[WebInvoke(Method = "POST", UriTemplate = "")]
        //[WebHelp(Comment = "Initializes the item based on the incoming XML.")]
        //TItem AddItemInXml(TItem initialValue);
        //[OperationContract]
        //[WebHelp(Comment = "Deletes the item.")]
        //[WebInvoke(Method = "DELETE", UriTemplate = "")]
        //void DeleteItem();
        //[WebGet(UriTemplate = "?format=json", ResponseFormat = WebMessageFormat.Json)]
        //[OperationContract]
        //[WebHelp(Comment = "Returns the item in JSON format.")]
        //TItem GetItemInJson();
        //[OperationContract]
        //[WebGet(UriTemplate = "")]
        //[WebHelp(Comment = "Returns the item in XML format.")]
        //TItem GetItemInXml();
        //[OperationContract]
        //[WebInvoke(Method = "PUT", UriTemplate = "?format=json", ResponseFormat = WebMessageFormat.Json)]
        //[WebHelp(Comment = "Edits the item based on the incoming JSON and returns the updated item in JSON format.")]
        //TItem UpdateItemInJson(TItem newValue);
        //[WebInvoke(Method = "PUT", UriTemplate = "")]
        //[OperationContract]
        //[WebHelp(Comment = "Edits the item based on the incoming XML and returns the updated item in XML format.")]
        //TItem UpdateItemInXml(TItem newValue);
        #endregion
    }
}
